<div class="wrapper-bz-page">
    <div class="wrapper-bz-body">
        <div class="column-block block-left" style="width:500px;">
            <div class="column-title">字典</div>
            <div class="column-content">
                <div class="column-filter">
                    <div class="common-search-box">
                        <input style="width:120px"  id="search_input_dictionary_in_m47" />
                    </div>
                </div>
                <div class="column-datagrid">
                    <table id="table_dictionary_in_m47" style="width:100%;height:100%"></table>
                </div>
            </div>
        </div>
        <div class="column-block block-right" style="left:510px;">
            <div class="column-title">数据选项</div>
            <div class="column-content">
                <div class="column-filter">
                    <div class="common-search-box">
                        <input style="width:120px"  id="search_input_dictionary_sub_in_m47" />
                    </div>
                </div>
                <div class="column-datagrid">
                    <table id="table_dictionary_sub_in_m47" style="width:100%;height:100%"></table>
                </div>
            </div>
        </div>
    </div>
</div>
<div id="dialog_add_dictionary_in_m47"></div>
<div id="dialog_edit_dictionary_in_m47"></div>
<div id="dialog_add_dictionary_sub_in_m47"></div>
<div id="dialog_edit_dictionary_sub_in_m47"></div>
<script>
    $(function(){
        var listTable = [
            {subject_keyword:"dictionary_in_m47", datagrid_code:"dictionary_m47"},
            {subject_keyword:"dictionary_sub_in_m47", datagrid_code:"dictionary_sub_m47"},
        ];
        var relateForeignId = 'dictionary_id';
        var datagridConfigList = $(document).getRelatedDatagridConfig(listTable, relateForeignId);

        var searchHiddenColumn = [
            ['ck', 'ID', '属性标识码', '属性(英)', '状态', '创建时间', '更新时间'],
            ['ck', 'ID', '属性ID','选项名(中)', '选项名(英)', '状态', '创建时间', '更新时间'],
        ];
        datagridConfigList[0].onSelect = function(index, row){
            datagridConfigList[1].queryParams = {[relateForeignId]:row.id};
            var searchInputId = "search_input_" + listTable[1].subject_keyword;
            var tableId = "table_" + listTable[1].subject_keyword
            $('#' + tableId).datagrid(datagridConfigList[1]);
            SearchCombobox(searchInputId, tableId, function (val, name) {
                datagridConfigList[1].queryParams = {};
                datagridConfigList[1].queryParams[name] = val;
                $('#' + tableId).datagrid(datagridConfigList[1]);
            }, searchHiddenColumn[1]);
        };
        $.each(listTable, function(index, item){
            var searchInputId = "search_input_" + item.subject_keyword;
            var tableId = "table_" + item.subject_keyword
            if(0 == index){
                $('#' + tableId).datagrid(datagridConfigList[index]);
                SearchCombobox(searchInputId, tableId, function (val, name) {
                    datagridConfigList[index].queryParams = {};
                    datagridConfigList[index].queryParams[name] = val;
                    $('#' + tableId).datagrid(datagridConfigList[index]);
                }, searchHiddenColumn[index]);
            }
        });

    });
</script>